<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  admin: 梁家源
  Date: 2021/6/3
  Time: 23:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>所有普通管理员</title>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/css/layui.css"/>
    <script src="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/layui.js" type="text/javascript"
            charset="UTF-8"></script>
    <script src="${pageContext.request.contextPath}/static/script/jquery-1.7.2.js" type="text/javascript"
            charset="UTF-8"></script>
</head>
<script>
    layui.use('element', function () {
        var element = layui.element;
    });

    layui.use('form', function () {
        var form = layui.form;
    });
</script>
<body>
    <fieldset class="layui-elem-field layui-field-title" style="margin: 20px" >
        <legend style="margin-left: 50px;">管理员管理</legend>
    </fieldset>

    <div class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md4">
                <form class="layui-form layui-form-pane" action="${pageContext.request.contextPath}/queryAdmin" method="post">
                    <div class="layui-form-item">
                        <div class="layui-input-inline" style="width: 172px">
                            <input type="text" class="layui-input" name="idOrName" placeholder="请输入要查寻的信息" autocomplete="off" lay-verify="required">
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn layui-btn-radius" title="搜索" lay-submit lay-filter="formDemo">
                                <i class="layui-icon">&#xe615;</i>
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="layui-col-md6">
                <c:if test="${sessionScope.admin.apower == 'root'}">
                    <button class="layui-btn layui-btn-primary layui-border-green">
                        <a href="${pageContext.request.contextPath}/toCreateAdminPage">新增管理员</a>
                    </button>
                </c:if>
            </div>
        </div>
        <%--        <div class="layui-row" style="border: 1px solid black;border-color: #9F9F9F" >--%>
        <div class="layui-row" >
            <table class="layui-table" lay-skin="nob">
                <colgroup>
                    <col width="100px"><!--序号-->
                    <col width="100px"><!--I D-->
                    <col width="170px"><!--名称-->
                    <col width="170px"><!--院系-->
                    <col width="250px"><!--手机-->
                    <col width="100px"><!--当前权限-->
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th>序号</th>
                    <th>I&nbsp;D</th>
                    <th>名称</th>
                    <th>院系</th>
                    <th>手机</th>
                    <th>当前权限</th>
                    <c:if test="${sessionScope.admin.apower == 'root'}">
                        <th>操&nbsp;作</th>
                    </c:if>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="admin" varStatus="status" items="${adminList}">
                    <tr>
                        <td>${status.count}</td>
                        <td>${admin.aid}</td>
                        <td>${admin.aname}</td>
                        <td>${admin.afaculty}</td>
                        <td>${admin.aphone}</td>
                        <td>${admin.apower}</td>
                        <td>
                        <c:if test="${sessionScope.admin.apower == 'root'}">
                            <a href="${pageContext.request.contextPath}/deleteAdmin?aid=${admin.aid}">
                                <button type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-border-black">删除</button>
                            </a>
                        </c:if>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>

    </div>

</body>
</html>
